#ifndef HEXAPOD_SERVO_IO_H
#define HEXAPOD_SERVO_IO_H

#include <stdint.h>

extern const int16_t int16_t_NONE;

extern const uint8_t SERVO_FRAME_HEADER;
extern const uint8_t SERVO_MOVE_TIME_WRITE;
extern const uint8_t SERVO_MOVE_TIME_READ;
extern const uint8_t SERVO_MOVE_TIME_WAIT_WRITE;
extern const uint8_t SERVO_MOVE_TIME_WAIT_READ;
extern const uint8_t SERVO_MOVE_START;
extern const uint8_t SERVO_MOVE_STOP;
extern const uint8_t SERVO_ID_WRITE;
extern const uint8_t SERVO_ID_READ;
extern const uint8_t SERVO_ANGLE_OFFSET_ADJUST;
extern const uint8_t SERVO_ANGLE_OFFSET_WRITE;
extern const uint8_t SERVO_ANGLE_OFFSET_READ;
extern const uint8_t SERVO_ANGLE_LIMIT_WRITE;
extern const uint8_t SERVO_ANGLE_LIMIT_READ;
extern const uint8_t SERVO_VIN_LIMIT_WRITE;
extern const uint8_t SERVO_VIN_LIMIT_READ;
extern const uint8_t SERVO_TEMP_MAX_LIMIT_WRITE;
extern const uint8_t SERVO_TEMP_MAX_LIMIT_READ;
extern const uint8_t SERVO_TEMP_READ;
extern const uint8_t SERVO_VIN_READ;
extern const uint8_t SERVO_POS_READ;
extern const uint8_t SERVO_OR_MOTOR_MODE_WRITE;
extern const uint8_t SERVO_OR_MOTOR_MODE_READ;
extern const uint8_t SERVO_LOAD_OR_UNLOAD_WRITE;
extern const uint8_t SERVO_LOAD_OR_UNLOAD_READ;
extern const uint8_t SERVO_LED_CTRL_WRITE;
extern const uint8_t SERVO_LED_CTRL_READ;
extern const uint8_t SERVO_LED_ERROR_WRITE;
extern const uint8_t SERVO_LED_ERROR_READ;


uint8_t checkSum(uint8_t buf[], uint8_t len);
void serialServoWriteMultiCmd(uint8_t cmd, int16_t data[][4], uint8_t num);
void serialSerroWriteCmd(uint8_t id, uint8_t w_cmd, int16_t dat1, int16_t dat2);
void serialServoReadCmd(uint8_t id, uint8_t r_cmd);
void serialServoGetMsg(uint8_t cmd, int16_t* value);

#endif
